]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowManager: Generalize translation values
authorAlessandro Bono <abono@gnome.org>
Sat, 20 May 2017 14:34:35 +0000 (16:34 +0200)
committerAlessandro Bono <abono@gnome.org>
Wed, 24 May 2017 19:10:28 +0000 (21:10 +0200)
Currently, the translation values are set with the assumption that
one of the actors represents a fullscreen window. In order to
generalize it for any size change transition, we can simply swap
the monitor rect with the source or target rect as appropriate,
and translate the actor from the target to the source position by
subtracting the former and adding the latter.

https://bugzilla.gnome.org/show_bug.cgi?id=766685

js/ui/windowManager.js

index b9874673c923834c0bbcae4450a72300fd23439c..8b5c461180b0ec8877975b005d24e5a596162257 100644 (file)
@@ -1331,13 +1331,11 @@ const WindowManager = new Lang.Class({
         actorClone.set_size(oldFrameRect.width, oldFrameRect.height);
         Main.uiGroup.add_actor(actorClone);
 
-        let rect = change == Meta.SizeChange.FULLSCREEN ? oldFrameRect : null;
-
         if (this._clearFullscreenInfo(actor))
             this._shellwm.completed_size_change(actor);
 
         actor.__fullscreenInfo = { clone: actorClone,
-                                   oldRect: rect };
+                                   oldRect: oldFrameRect };
     },
 
     _sizeChangedWindow: function(shellwm, actor) {
@@ -1365,15 +1363,9 @@ const WindowManager = new Lang.Class({
                            transition: 'easeOutQuad'
                          });
 
-        let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
         let sourceRect = actor.__fullscreenInfo.oldRect;
-        if (sourceRect) {
-            actor.translation_x = sourceRect.x - monitor.x;
-            actor.translation_y = sourceRect.y - monitor.y;
-        } else {
-            actor.translation_x = -(targetRect.x - monitor.x);
-            actor.translation_y = -(targetRect.y - monitor.y);
-        }
+        actor.translation_x = -targetRect.x + sourceRect.x;
+        actor.translation_y = -targetRect.y + sourceRect.y;
 
         // Now set scale the actor to size it as the clone.
         actor.scale_x = 1 / scaleX;